<template>
	<view class="container">
		<view class="list-cell-section icon">
			<view class="zy-head" >
				<view class="zy-head-title">余额</view>
				<view class="zy-head-extra" @click="toWithdrawList">提现记录</view>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">总余额</text>
				<text class="cell-content">{{userWallet.rmbBalance}}</text>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">可用余额</text>
				<text class="cell-content">{{userWallet.usableRmbBalance}}</text>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">冻结余额</text>
				<text class="cell-content">{{userWallet.frozenRmbBalance}}</text>
			</view>
		</view>
		
		<view class="list-cell-section icon">
			<view class="zy-head" >
				<view class="zy-head-title">积分</view>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">总积分</text>
				<text class="cell-content">{{userWallet.integral}}</text>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">可用积分</text>
				<text class="cell-content">{{userWallet.usableIntegral}}</text>
			</view>
			<view class="zy-list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
				<text class="cell-tit">冻结积分</text>
				<text class="cell-content">{{userWallet.frozenIntegral}}</text>
			</view>
		</view>
		
		<button class="zy-add-btn" @click="toWithdraw">余额提现</button>
	</view>
</template>

<script>
	
	import { showInfoToast } from '@/common/util.js'
	import zyworkIcon from '@/components/zywork-icon/zywork-icon.vue'
	import listCell from '@/components/mix-list-cell';
	
	export default {
		components: {
			listCell,
			zyworkIcon
		},
		data() {
			return {
				userWallet: {}
			}
		},
		onLoad(options) {
			this.userWallet = JSON.parse(options.userWallet)
		},
 		methods: {
			toWithdraw() {
				let wallet = JSON.stringify(this.userWallet)
				uni.navigateTo({
					url: `/pages/wallet/withdraw?userWallet=${wallet}`
				})
			},
			toWithdrawList() {
				uni.navigateTo({
					url: '/pages/wallet/withdraw-list'
				})
			}
		}
	}
</script>

<style lang="scss">
	@import '@/common/zywork-main.scss';
	.zy-head {
		padding: 10upx 0upx;
		margin-top: 20upx;
		background: #FFF;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.zy-head-title {
		border-left: 5px solid #fa436a;
		padding-left: 20upx;
		margin-left: 20upx;
		font-size: 28upx;
	}
	.zy-head-extra {
		padding-right: 10upx;
		font-sise: 24upx;
		color: #FA436A;
	}
	
	.list-cell-section {
		padding: 30upx 0 0;
		margin-top: 20upx;
		background: #fff;
		border-radius: 10upx;
	}
</style>
